package cl.parser.internal;

import java.util.ArrayList;
import java.util.List;

import cl.parser.IParseNode;
import cl.parser.external.IdentifierNode;
import cl.parser.external.IntegerNode;
import cl.parser.external.StringNode;

public class TermNode extends InternalNode {

    @Override
    public String prettyPrint(String indent) {
        String res = "";
        
        for(IParseNode p : children) {
            res += p.prettyPrint(indent);
        }
        
        return res;
    }
    
    @Override
    protected List<IParseNode> getAllowed(IParseNode last, List<IParseNode> soFar) {
        List<IParseNode> allowed = new ArrayList<IParseNode>();
        
        if(last == null) {
            allowed.add(new FunctionCallNode());
            allowed.add(new IdentifierNode());
            allowed.add(new IntegerNode());
            allowed.add(new StringNode());
        } 
        //struct connectors
        
        return allowed;
    }

    @Override
    protected boolean isValid(IParseNode last, List<IParseNode> soFar) {
        return last != null;
    }

}
